<?php

/*
 * This file is part of echo/hello.
 *
 * Copyright (c) 2022 echo.
 *
 * For the full copyright and license information, please view the LICENSE.md
 * file that was distributed with this source code.
 */

namespace Wanecho\FlarumApp;

use Flarum\Extend;
use Flarum\Api\Serializer\PostSerializer;
use Wanecho\FlarumApp\Controllers\DownloadAppController;
use Wanecho\FlarumApp\Controllers\DeleteImageController;
use Wanecho\FlarumApp\Controllers\UploadImageController;
use Flarum\Frontend\Document;
use Wanecho\FlarumApp\AppServiceProvider;

return [
    (new Extend\Frontend('forum'))
        ->js(__DIR__ . '/js/dist/forum.js')
        ->css(__DIR__ . '/less/forum.less')
        ->route('/downloadapp', 'downloadapp.index', DownloadAppController::class),
    (new Extend\Frontend('admin'))
        ->js(__DIR__ . '/js/dist/admin.js')
        ->css(__DIR__ . '/less/admin.less'),
    new Extend\Locales(__DIR__ . '/locale'),
    (new Extend\Frontend('forum'))->content(function (Document $document) {
        // $document->head[] = '<script src="https://cdn.bootcdn.net/ajax/libs/mui/3.7.1/js/mui.min.js"></script>';
    }),
    (new Extend\Routes('api'))
        ->post('/flarum_app_logo', 'flarum_app_logo', UploadImageController::class)
        ->delete('/flarum_app_logo', 'flarum_app_logo.delete', DeleteImageController::class),
    //(new Extend\Event())->subscribe(Listeners\QueueIptoCityJobs::class),
    //(new Extend\ApiSerializer(PostSerializer::class))->attributes(AddPostAttributes::class),
    // (new Extend\Console())->command(Console\HelloTest::class),
    // (new Extend\Routes('forum'))->get('/getAppver', 'get.appver', AppController::class),
    (new Extend\Settings)
        ->serializeToForum('flarum.app.open', 'flarum.app.open')
        ->serializeToForum('flarum.app.appid', 'flarum.app.appid')
        ->serializeToForum('flarum.app.title', 'flarum.app.title')
        ->serializeToForum('flarum.app.note', 'flarum.app.note')
        ->serializeToForum('flarum.app.ver', 'flarum.app.ver')
        ->serializeToForum('flarum.app.apk', 'flarum.app.apk')
        ->serializeToForum('flarum.app.type', 'flarum.app.type')
        ->serializeToForum('flarum.app.wgt', 'flarum.app.wgt')
        ->serializeToForum('flarum_app_logo_path', 'flarum_app_logo_path'),
    (new Extend\ServiceProvider)->register(AppServiceProvider::class),
];
